﻿using UnityEngine;
using System.Collections;

public class BattleResultTestScene : MonoBehaviour
{
    public GameObject battleResultIbject;
    public GameObject battleResultLoopObject;
    public GameObject[] characters;
    public Transform[] cameraPosInChar;
    public Transform[] camearaTransforms;
	public Animation cameraAnimation;


	// Use this for initialization
	void Start () {
        StartCoroutine("Co_Setting");
	}

    IEnumerator Co_Setting()
    {
        yield return new WaitForSeconds(1f);

        for (int i = 0; i < 4; i++)
        {
            characters[i].GetComponent<Animation>().Play();
        }

        for (int i = 0; i < 4; i++)
        {
            yield return new WaitForEndOfFrame();
            camearaTransforms[i].position = cameraPosInChar[i].position;
            camearaTransforms[i].rotation = cameraPosInChar[i].rotation;
        }

        yield return new WaitForSeconds(0.5f);

        battleResultIbject.SetActive(true);
		cameraAnimation.Play();
        battleResultIbject.GetComponent<Animation>().Play();
        battleResultLoopObject.SetActive(true);
        battleResultLoopObject.GetComponent<Animation>().Play();
    }
	
	// Update is called once per frame
	void Update () {
	
	}
}
